//
//  UIViewController+HDHZ.swift
//  QDMetroClient
//
//  Created by YueWen on 2019/4/17.
//  Copyright © 2019 YueWen. All rights reserved.
//

import Foundation

/// 活动盒子的响应控制器,由于混编，放弃POP

extension NSObject {
    
    /// 活动盒子的属性
    @objc func hzProperties() -> [String: String] {
        
        let id = !QDUserStatus.isLogin ? "visitor" :  QDUserInfoModel.share.id
        return ["username": id, "mobile": id]
    }
}




extension UIViewController: HeziBannerOpenActivePageDelegate {
    
    // 进行活动盒子的弹跳
    public func heziBannerWillOpenActivePage(_ heziBanner: HeziBanner, activityURL url: String, didSelectedIndex index: Int) -> Bool {
        
        if !QDUserStatus.isLogin {
            checkLogin {}; return false
        }
        
        /// 跳到自己的控制器
        let webController = QDHDHZWebViewController()
        webController.url = url
        webController.autoTitle = true
        webController.webTitle = "活动"
        webController.hidesBottomBarWhenPushed = true
        ritl_topNavigationPush(webController, animated: true)
        
        
//        pushToWebViewController(url: url, autoTitle: false, title: "活动")
        return false
    }
}
